// 加载页面路由
const indexRouter = require('./pages/index')

// 加载API接口路由
const getAutoTile = require('./api/getAutoTile')
const addAutoTile = require('./api/addAutoTile')
const deleteAutoTile = require('./api/deleteAutoTile')

const getTileset = require('./api/getTileset')
const getTilesetImages = require('./api/getTilesetImages')
const addTileset = require('./api/addTileset')
const renameTileset = require('./api/renameTileset')
const deleteTileset = require('./api/deleteTileset')
const deleteTilesetImages = require('./api/deleteTilesetImages')
const addTilesetImages = require('./api/addTilesetImages')

const getEnv = require('./api/getEnv')
const addEnv = require('./api/addEnv')
const deleteEnv = require('./api/deleteEnv')
const renameEnv = require('./api/renameEnv')
const setEnv = require('./api/setEnv')
const setEnvTiles = require('./api/setEnvTiles')
const setEnvAutotile = require('./api/setEnvAutotile')
const getEnvDetail = require('./api/getEnvDetail')

const getMaps = require('./api/getMaps')
const getMapFile = require('./api/getMapFile')
const getMapPreparations = require('./api/getMapPreparations')
const addMap = require('./api/addMap')
const addMapFile = require('./api/addMapFile')
const renameMap = require('./api/renameMap')
const deleteMap = require('./api/deleteMap')
const setMapDetail = require('./api/setMapDetail')

const output = require('./api/output')

var router = {
  // 初始化路由
  init (app) {
    // 初始化页面路由
    app.use('/', indexRouter)
    
    // 初始化API路由    
    app.use('/api/getAutoTile', getAutoTile)
    app.use('/api/addAutoTile', addAutoTile)
    app.use('/api/deleteAutoTile', deleteAutoTile)
    
    app.use('/api/getTileset', getTileset)
    app.use('/api/getTilesetImages', getTilesetImages)
    app.use('/api/addTileset', addTileset)
    app.use('/api/renameTileset', renameTileset)
    app.use('/api/deleteTileset', deleteTileset)
    app.use('/api/deleteTilesetImages', deleteTilesetImages)
    app.use('/api/addTilesetImages', addTilesetImages)
    
    app.use('/api/getEnv', getEnv)
    app.use('/api/addEnv', addEnv)
    app.use('/api/deleteEnv', deleteEnv)
    app.use('/api/renameEnv', renameEnv)
    app.use('/api/setEnv', setEnv)
    app.use('/api/setEnvTiles', setEnvTiles)
    app.use('/api/setEnvAutotile', setEnvAutotile)
    app.use('/api/getEnvDetail', getEnvDetail)
    
    app.use('/api/getMaps', getMaps)
    app.use('/api/getMapFile', getMapFile)
    app.use('/api/getMapPreparations', getMapPreparations)
    app.use('/api/addMap', addMap)
    app.use('/api/addMapFile', addMapFile)
    app.use('/api/renameMap', renameMap)
    app.use('/api/deleteMap', deleteMap)
    app.use('/api/setMapDetail', setMapDetail)
    
    app.use('/api/output', output)
  }
}

module.exports = router